package leeon.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {
	
	public static boolean gtDiffYear(String before, String after, int diff, String format) throws ParseException {
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		Date d1 = sdf.parse(before);
		Date d2 = sdf.parse(after);
		Calendar c = Calendar.getInstance();
		c.setTime(d1);
		c.add(Calendar.YEAR, diff);
		return c.getTime().before(d2);
	}
	
	public static boolean gtDiffYear(String before, String after, int diff) throws ParseException {
		return gtDiffYear(before, after, diff, "yyyy-MM-dd");
	}

}
